package chapter5.No5_1_定时器Timer的使用.demo2;

import java.util.Calendar;
import java.util.Date;
import java.util.Timer;

/**
 * 设置成守护线程
 */
public class Main {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
        c.add(Calendar.SECOND, 10);
        Date date = c.getTime();

        MyTask task = new MyTask();
        Timer timer = new Timer(true);
        timer.schedule(task, date);
        System.out.println("开始运行的时间："+System.currentTimeMillis());
    }
}
